package com.kouxin.appaccount.appuser;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class AppUserDao extends HibernateDaoSupport {

	public void insert(AppUser appuser) {
		this.getHibernateTemplate().save(appuser);
	}
	
	@SuppressWarnings("unchecked")
	public List<AppUser> findByExample(AppUser appuser) {
		return (List<AppUser>)this.getHibernateTemplate().findByExample(appuser);
	}
	
	@SuppressWarnings("unchecked")
	public AppUser login(AppUser appuser) {
		List list = this.getHibernateTemplate().findByExample(appuser);
		if (list != null && list.iterator().hasNext()) {
			return (AppUser)list.iterator().next();
		}
		return null;
	}
}
